#define  _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <stdlib.h>
//struct student {
//	int yw, sx, yy, zf, xh;
//};
//int n;
//int cmp(const void* a, const void* b) {
//	if (((struct student*)a)->zf != ((struct student*)b)->zf)return ((struct student*)b)->zf - ((struct student*)a)->zf;
//	else if (((struct student*)a)->yw != ((struct student*)b)->yw)return ((struct student*)b)->yw - ((struct student*)a)->yw;
//	else
//		return ((struct student*)b)->xh - ((struct student*)b)->xh;
//}
//int main() {
//	struct student arr[350] = { 0 };
//	scanf("%d", &n);
//	for (int i = 0; i < n; i++) {
//		scanf("%d %d %d", &arr[i].yw, &arr[i].sx, &arr[i].yy);
//		arr[i].zf = arr[i].yw + arr[i].sx + arr[i].yy;
//		arr[i].xh = i + 1;
//	}
//	qsort(arr, n, sizeof(arr[0]), cmp);
//	for (int i = 0; i < (5 > n ? n : 5); i++) {
//		printf("%d %d\n", arr[i].xh, arr[i].zf);
//	}
//	return 0;
//}
